package cn.shenshen.shop.util;

import lombok.Getter;
import lombok.Setter;

import java.security.MessageDigest;
import java.text.MessageFormat;

@Getter
@Setter
public class MemberCodeMsg extends CodeMsg{
    public MemberCodeMsg(int code,String msg){
        super(code,msg);
    }

    //定义用户登录相关的错误日志信息
    public static MemberCodeMsg USERNAME_PASSWORD_ERROR = new MemberCodeMsg(500001,"用户名或者密码错误");

    //用户参数异常
    public static MemberCodeMsg PARAM_ERROR= new MemberCodeMsg(500002,"参数异常:{0}");

    public static MemberCodeMsg fillArgs(String msg){
        String format = MessageFormat.format(PARAM_ERROR.getMsg(), msg);
        return new MemberCodeMsg(PARAM_ERROR.getCode(),format);
    }

}
